package com.ruoyi.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.RiverNews;
import org.apache.ibatis.annotations.Mapper;

/**
 * river_newsMapper接口
 * 
 * @author ya
 * @date 2025-06-22
 */
@Mapper
public interface RiverNewsMapper extends BaseMapper<RiverNews>
{
    public int insertRiverNewsOwn(RiverNews riverNews);
    public int updateRiverNewsOwn(RiverNews riverNews);

    /**
     * 查询river_news
     * 
     * @param newsId river_news主键
     * @return river_news
     */
    public RiverNews selectRiverNewsByNewsId(Long newsId);

    /**
     * 查询river_news列表
     * 
     * @param riverNews river_news
     * @return river_news集合
     */
    public List<RiverNews> selectRiverNewsList(RiverNews riverNews);

    /**
     * 新增river_news
     * 
     * @param riverNews river_news
     * @return 结果
     */
    public int insertRiverNews(RiverNews riverNews);

    /**
     * 修改river_news
     * 
     * @param riverNews river_news
     * @return 结果
     */
    public int updateRiverNews(RiverNews riverNews);

    /**
     * 删除river_news
     *
     * @param newsId river_news主键
     * @return 结果
     */
    public int deleteRiverNewsByNewsId(Long newsId);

    /**
     * 查询未下架且最新日期的8条河道要闻
     *
     * @return 河道要闻集合
     */
    public List<RiverNews> selectLatest8RiverNews();

    /**
     * 批量删除river_news
     * 
     * @param newsIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteRiverNewsByNewsIds(Long[] newsIds);
    
    /**
     * 下架river_news
     * 
     * @param newsId river_news主键
     * @return 结果
     */
    public int offShelfRiverNewsByNewsId(Long newsId);
    
    /**
     * 上架river_news
     * 
     * @param newsId river_news主键
     * @return 结果
     */
    public int onShelfRiverNewsByNewsId(Long newsId);

    /**
     * 获取最大排序值
     */
    public int selectMaxSortOrder();

    /**
     * 将排序值小于给定值的记录的排序值加1
     */
    public void incrementSortOrderLessThan(int sortOrder);

    /**
     * 查找排序值刚好小于给定值的记录
     */
    public RiverNews selectPreviousRiverNews(int sortOrder);

    /**
     * 查找排序值刚好大于给定值的记录
     */
    public RiverNews selectNextRiverNews(int sortOrder);
}
